import { assertEquals } from "asserts";

import { TreeNodeLeetCodeFromJSON } from "../utils/TreeNodeLeetCodeParse.ts";
import widthOfBinaryTree from "./index.ts";

Deno.test("maximum-width-of-binary-tree", () => {
    const trees = [
        [1, 3, 2, 5, 3, null, 9],
        [1, 3, 2, 5, null, null, 9, 6, null, 7],
        [1, 3, 2, 5],
        [
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            null,
            0,
            1,
            2,
            3,
            4,
            5,
            6,
        ],
        [
            1,
            1,
            1,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            null,
            1,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
            1,
            null,
        ],
    ];
    const results = [4, 7, 2, 4, 2147483645];

    assertEquals(
        trees.map(TreeNodeLeetCodeFromJSON).map(widthOfBinaryTree),
        results,
    );
});
